package com.hxd.otc.module.convenience.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hxd.otc.R;
import com.hxd.otc.base.BaseAdapter;
import com.hxd.otc.module.convenience.bean.PaymentMethodBean;
import com.hxd.otc.utils.ResourceUtil;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by lzy on 2018/12/12 0012.
 * description ${支付方式Adapter}
 */
public class PaymentMethodAdapter extends BaseAdapter<PaymentMethodAdapter.PaymentMethodHolder, PaymentMethodBean> {

    public PaymentMethodAdapter(Context context) {
        super(context);
    }

    @Override
    protected void onBindHolder(@NonNull PaymentMethodHolder holder, int position) {
        PaymentMethodBean item = getItem(position);
        holder.tvPaymentMethod.setText(ResourceUtil.getString(R.string.sub_payment, item.getSymbol()));
    }

    @NonNull
    @Override
    public PaymentMethodHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new PaymentMethodHolder(mInflater.inflate(R.layout.item_pay_method_panel, parent, false));
    }

    static class PaymentMethodHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_payment_method)
        TextView tvPaymentMethod;

        public PaymentMethodHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
